package com.dyh.quickdemo.demos;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.HashMap;

public class Ltest {

    @Test
    public void test4(){
        String r = "abcdefgh";
        int[] ll = {3,2,1,1};
        String[] res ={"","","",""};
        int t = 0;
        for (int i =0;i<ll.length;i++) {

            res[i] = r.substring(t,Math.min(t+ll[i],r.length()));
            t = t+ll[i];
        }
//        String a = r.substring(0,2);
//        String b = r.substring(2,4);
//        String c = r.substring(4,r.length());

        System.out.println();
    }

    @Test
    public void test3(){
        String raw = "画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张";

        int limit []= {127,34,34,34};
        String[] arr = {"","","",""};

        if (raw.length()<=127){
            arr[0] = raw;
        }
        if (raw.length()>127 && raw.length()<127+33){
            arr[0] = raw.substring(0,127);
            arr[1] = raw.substring(127);
        }
    }

    @Test
    public void test(){
        String
                s =
                "画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一；刻字内容：张三画布：薇娅款一";

        String s2 =
                "";
        System.out.println(s.length());
        System.out.println(s2.length());

    }
    @Test
    public void test2(){

        System.out.println(rtString(1));
        System.out.println(rtString(new HashMap<>()));
        System.out.println(rtString(new ArrayList<>()));
//        System.out.println(1.toS);
    }

    public String rtString(Object obj){
        System.out.println();
        return obj.toString();
    }

    @Test    public void test1(){
//        System.out.println(     JpG3.ShiRanui.getClass().isAssignableFrom(G3.class)  );
//        System.out.println(     JpG3.ShiRanui.getClass().isAssignableFrom(TSF.class)  );
//        System.out.println(     JpG3.ShiRanui.getClass().isAssignableFrom(JP.class)  );
//        System.out.println(    G2.class.isAssignableFrom(TSF.class)  );
//        System.out.println(    TSF.class.isAssignableFrom(TSF.class)  );
//        System.out.println(    TSF.class.isAssignableFrom(G2.class)  );

        System.out.println(TSF.class.isAssignableFrom(JpG3.ShiRanui.getClass()));
        System.out.println(JP.class.isAssignableFrom(JpG3.ShiRanui.getClass()));
        System.out.println(G3.class.isAssignableFrom(JpG3.ShiRanui.getClass()));
        System.out.println(G2.class.isAssignableFrom(JpG3.ShiRanui.getClass()));
        // System.out.println(     JpG3.ShiRanui instanceof G3 );

    }

     interface TSF{}
     interface G2 extends TSF{}
     interface G3 extends TSF{}
     interface JP{}

     enum JpG2 implements JP,G2{
        Gekishin,
        Fubuki,
        Tsuigaku,
    }

     enum JpG3 implements JP,G3{
        ShiRanui,
        TakaMikatsuChi,
    }






}
